$(function () {
    ChaXun();
})

function ChaXun() {
    $("#ChaXunTable").bootstrapTable({
        //请求方式  get请求中文会乱码，建议使用post请求
        method: 'post',
        //请求头部的设置
        contentType: 'application/json',
        //url
        url: '/Mdesignprocedure.do/PageChaXun',
        //设置交替行样式
        striped: true,
        //初始显示页号
        pageNumber: 1,
        //设置表格高度
        //height: 350,
        //是否显示分页
        pagination: true,
        //设置是服务端分页还是客户端分页
        sidePagination: 'server',
        //页大小
        pageSize: 5,
        //分页列表
        pageList: [3, 5, 6, 10],
        queryParams: function (params) {
            return {
                num: params.offset / params.limit + 1,
                size: params.limit
            }
        },
        pagination: true,
        //上传到服务端的参数
        columns: [
            {title: "设计单编号", field: "designid", align: 'center',
                formatter: function (vale, row, index) {
                let s= JSON.stringify(row)
                    let str = "<a href='#' onclick='XQ("+s+")'>"+vale+"</a>";
                    return str;
                }},
            {title: "产品编号", field: "productid", align: 'center'},
            {title: "产品名称", field: "productname", align: 'center'},
            {
                title: "设计状态", field: "designmoduletag", align: 'center',
                formatter: function (vale, row, index) {
                    let s = vale == 'G002-2' ? '完成' : '等待';
                    let str = "<span>" +s+ "</span>";
                    return str;
                }
            },
            {
                title: "审核状态", field: "designmoduletag", align: 'center',
                formatter: function (vale, row, index) {
                    let str = "<span style=\"color: "+ (vale == 'G002-2' ? 'lime' :vale == 'G002-3' ? 'red':'black') +";\">" +
                        (vale == 'G002-2' ? '通过' : vale == 'G002-3' ?'不通过':'等待') + "</span>";
                    return str;
                }
            }
        ]
    })
}

function XQ(op) {
    localStorage.setItem("mdesignprocedureCha",JSON.stringify(op));
    location.href="/li_meng/mdesignprocedureChaXQ.html";
}